<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
  <script src="../../../js-test-resources/js-test.js"></script>
  <script>
    function runTest() {
      description('Tests that loading a frame with a URL that contains a fragment pointed at a named anchor actually scrolls to that anchor.');

      // Check scroll position in a timeout to make sure that the anchor has
      // been scrolled to.
      setTimeout(function() {
          // Make sure that the body is taller than the viewport (i.e. scrolling is
          // required).
          shouldBeTrue('document.body.offsetHeight > document.documentElement.clientHeight');
          
          // We should be scrolled at least a little bit
          shouldBeTrue('document.documentElement.scrollTop > 0');
          
          // And the bottom of the viewable area should be at least 2000 pixels from the top, due to the spacer element above.
          shouldBeTrue('document.documentElement.scrollTop + document.documentElement.clientHeight > 2000');

          finishJSTest();          
      }, 0);
    }
    
    var jsTestIsAsync = true;
  </script>  
</head>
<body onload="runTest()">
<p id="description"></p>
<div id="console"></div>

<div style="height: 2000px">
  <!-- Spacer to make sure that the named anchor below requires scrolling -->
</div>

<a name="&#x586f">This is an anchor point named as the Unicode equivalent of the GBK sequence %a9g (test trailing low byte)</a>.
</body>
</html>
